package com.example.admin.startproject_404fzx.retrofitRequest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.example.admin.startproject_404fzx.bean.WeatherInfo;
import com.example.admin.startproject_404fzx.listener.WeatherListener;
import com.example.admin.startproject_404fzx.mode.WeatherModel;
import com.example.admin.startproject_404fzx.R;

public class MainActivity extends AppCompatActivity implements WeatherListener,View.OnClickListener{
    private EditText et_citynumber;
    private TextView tv_cityname;
    private Button btn_find1;
    private Button btn_find2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
    }
    private void init(){
        et_citynumber =(EditText) findViewById(R.id.editText_cityno);
        tv_cityname =(TextView) findViewById(R.id.editText_cityno);
        btn_find1 =(Button) findViewById(R.id.button);
        btn_find2 =(Button) findViewById(R.id.button2);
        btn_find1.setOnClickListener(this);
    }

    @Override
    public void onResponse(WeatherInfo weather) {

    }

    @Override
    public void onFail(String msg) {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.button:
                WeatherModel weatherModel = new WeatherModel();
                weatherModel.getWeather(et_citynumber.getText().toString(),this);
                break;
            case R.id.button2:
                break;
            default:
                break;
        }
    }
}
